from selenium import webdriver
import time
from selenium.webdriver.common.by import By

class TestCase:
    def __init__(self):
        self.driver = webdriver.Chrome()
    def get_baidu(self):
    # 打开百度
        self.driver.get ('https://www.baidu.com')
        time.sleep(2)
        self.driver.find_element(By.ID,'kw').send_keys('天气预报')

        time.sleep(2)
        self.driver.find_element(By.ID,'su').click()
    #def get_os(self):
        #pass

    def quit(self,seconds=2):
        time.sleep(seconds)
        self.driver.quit()

if __name__== '__main__':
    it = TestCase()
    it.get_baidu()
    it.quit()
# 不封装
# time.sleep



